using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for bzAdminLang
/// </summary>
public class bzAdminLang
{
    private DataRow adminLang = null;
    private string _TableName = "bzAdminLang";

    public struct Language
    {
        private static string _Vietnamese = "VN";
        public static string Vietnamese { get { return _Vietnamese; } }

        private static string _English = "EN";
        public static string English { get { return _English; } }
    }
    public static string checkLang(string strLang)
    {
        switch (strLang)
        {            
            //case "EN": return "EN";
            default: return Language.Vietnamese;
        }
    }
	public bzAdminLang(string strLang,string Note)
	{
        this.loadAdminLang(strLang,Note);
	}
    public void loadAdminLang(string strLang,string Note)
    {
        SqlParameter[] p = new SqlParameter[2];
        p[0] = new SqlParameter("@Table",_TableName);
        p[1] = new SqlParameter("@Note", Note);
        DataTable dt = new dbConnection().getDataTable("SP_getLang",p);
        DataTable tmp = new DataTable();
        foreach (DataRow dr in dt.Rows)
        {
            DataColumn col = new DataColumn(dr["Name"].ToString(), typeof(string));
            tmp.Columns.Add(col);
        }
        this.adminLang = tmp.NewRow();
        foreach (DataRow dr in dt.Rows)
        {
            this.adminLang[dr["Name"].ToString()] = dr["Enabled"].ToString() == "0" ? "" : dr["Value" + strLang].ToString();
        }        
    }
    public DataRow AdminLang
    {
        get
        {
            return this.adminLang;
        }
    }
}
